package com.czztjj.springboottest.service.impl;

import com.czztjj.springboottest.entity.PersonMybatis;
import com.czztjj.springboottest.mapper.PersonMybatisMapper;
import com.czztjj.springboottest.service.IPersonMybatisService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@RequiredArgsConstructor
public class PersonMybatisService implements IPersonMybatisService {

    private final PersonMybatisMapper personMybatisMapper;

    @Override
    public List<PersonMybatis> getFromMysqlByMyBatis() {
        return personMybatisMapper.getFromMysqlByMyBatis();
    }

    @Override
    public void paramTest() {
        int id = 1;
        PersonMybatis personMybatis = personMybatisMapper.selectOne(id);
        final PersonMybatis personMybatis1 = new PersonMybatis();
        personMybatis1.setAge(401);
        personMybatis.setSex("F");

        List<PersonMybatis> list = personMybatisMapper.selectByAgeAndSex(personMybatis1);

        final List<Integer> idList = List.of(1, 2, 3, 4, 5, 6, 7);
        List<PersonMybatis> list1=  personMybatisMapper.selectPersonListByIds(idList);
    }

}
